package cn.ylz.ylmall.aftersale.dao.persist.repository.impl;

import cn.ylz.ylmall.aftersale.dao.persist.mapper.AfterSaleMapper;
import cn.ylz.ylmall.aftersale.dao.persist.repository.AfterSaleRepository;
import cn.ylz.ylmall.aftersale.pojo.entity.AfterSale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author pc
 */
@Repository
public class AfterSaleRepositoryImpl implements AfterSaleRepository {

    @Autowired
    private AfterSaleMapper afterSaleMapper;

    /**
     * 新增售后
     *
     * @return
     */
    @Override
    public int insertAfterSale(AfterSale afterSale) {
        return afterSaleMapper.insert(afterSale);
    }

    /**
     * 查询用户售后列表
     *
     * @param userId
     * @return
     */
    @Override
    public List<AfterSale> selectAfterSaleList(Long userId) {
        return afterSaleMapper.selectAllByUserId(userId);
    }

    /**
     * 查询所有售后列表
     *
     * @return
     */
    @Override
    public List<AfterSale> selectAll() {
        return afterSaleMapper.selectAll();
    }

    /**
     * 删除售后
     *
     * @param orderNo
     * @return
     */
    @Override
    public int delectByOrderNo(String orderNo) {
        return afterSaleMapper.delByOrderNo(orderNo);
    }
}
